package org.jeecg.modules.demo.st.service.impl;

import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.demo.st.entity.StStudent;
import org.jeecg.modules.demo.st.mapper.StStudentMapper;
import org.jeecg.modules.demo.st.service.IStProfessionService;
import org.jeecg.modules.demo.st.service.IStPunishService;
import org.jeecg.modules.demo.st.service.IStStateJiluService;
import org.jeecg.modules.demo.st.service.IStStudentService;
import org.jeecg.modules.demo.st.vo.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Description: 学生信息
 * @Author: jeecg-boot
 * @Date:   2019-10-26
 * @Version: V1.0
 */
@Service
public class StStudentServiceImpl extends ServiceImpl<StStudentMapper, StStudent> implements IStStudentService {
    @Autowired
    private StStudentMapper stStudentMapper;
    @Autowired
    private IStProfessionService stProfessionService;
    @Autowired
    private IStPunishService stPunishService;


    @Override
    public List<StudentListVo> getLists(String classId, Integer pageNo, Integer pageSize){
        List<StudentListVo> studentListVos= stStudentMapper.getListByClass(classId,(pageNo-1)*pageSize,pageSize);
        return studentListVos;
    }
     @Override
     public  StStudent getStudent(String stuId){
         StStudent obj= stStudentMapper.getStudent(stuId);
        return obj;
    }
    @Override
    public List<StudentListVo> getLists(String classId, String departId, String professionId, String nationality,String status, String province,
                                        String city,
                                        String area,String fieldTwo,String face, String difficult, String psychological,String graduation,String single,String academicWarning,String delayedGraduation,Integer pageNo, Integer pageSize){
        List<StudentListVo> studentListVos= stStudentMapper.getListByFront(classId,departId,professionId,nationality,status,province,city,area,fieldTwo,face,difficult,psychological,graduation,single,academicWarning,delayedGraduation,(pageNo-1)*pageSize,pageSize);
        return studentListVos;
    }
    @Override
    public List<NationPersonsVo> getPsychologicals(String departIds, String professionIds, String classIds,String fieldTwo){
        List<NationPersonsVo> Psychologicals= stStudentMapper.getPsychologicals(departIds,professionIds,classIds,fieldTwo);
        return Psychologicals;
    }

    @Override
    public List<NationPersonsVo> getPunishs(String departIds, String professionIds, String classIds,String fieldTwo){
        List<NationPersonsVo> Punishs= stStudentMapper.getPunishs(departIds,professionIds,classIds,fieldTwo);
        return Punishs;
    }

    @Override
    public List<NationPersonsVo> getGraduations(String departIds, String professionIds, String classIds,String fieldTwo){
        List<NationPersonsVo> Graduations= stStudentMapper.getGraduations(departIds,professionIds,classIds,fieldTwo);
        return Graduations;
    }


    @Override
    public List<NationPersonsVo> getSingles(String departIds, String professionIds, String classIds,String fieldTwo){
        List<NationPersonsVo> Singles= stStudentMapper.getSingles(departIds,professionIds,classIds,fieldTwo);
        return Singles;
    }

    @Override
    public List<NationPersonsVo> getAcademicWarnings(String departIds, String professionIds, String classIds,String fieldTwo){
        List<NationPersonsVo> AcademicWarnings= stStudentMapper.getAcademicWarnings(departIds,professionIds,classIds,fieldTwo);
        return AcademicWarnings;
    }

    @Override
    public Map<String, Object> getStatisticsStudentSYT(String departIds, String professionIds, String classIds, String fieldTwo) {
        List<NationPersonsVo> sysDeparts = stProfessionService.getGradeListsSt(departIds,fieldTwo,professionIds,classIds);
        List<NationPersonsVo> studentVo = this.getNationPeoples(departIds,fieldTwo,professionIds,classIds);
        //List<NationPersonsVo> provincesVos = stStudentService.getProvincesSt(departIds,fieldTwo,professionIds,classIds);
        List<NationPersonsVo> studentListVos = this.getFacePersons(departIds,professionIds,classIds,fieldTwo);
        List<NationPersonsVo> studentListV = this.getDifficults(departIds,professionIds,classIds,fieldTwo);
        List<NationPersonsVo> studentList = this.getPsychologicals(departIds,professionIds,classIds,fieldTwo);
        List<NationPersonsVo> studentLis = this.getGraduations(departIds,professionIds,classIds,fieldTwo);
        List<NationPersonsVo> studentLi = this.getSingles(departIds,professionIds,classIds,fieldTwo);
        List<NationPersonsVo> studentL = this.getAcademicWarnings(departIds,professionIds,classIds,fieldTwo);
        List<NationPersonsVo> student = this.getDelayedGraduations(departIds,professionIds,classIds,fieldTwo);
        List<NationPersonsVo> studen = this.getPunishs(departIds,professionIds,classIds,fieldTwo);

        Map<String,Object> nationCou=new HashMap<>();
        nationCou.put("nianji",sysDeparts);
        nationCou.put("mingzu",studentVo);
        //nationCou.put("lixiao",provincesVos.get(0).getCou());
        nationCou.put("zhengzhimianmao",studentListVos);
        nationCou.put("jiatingkunnan",studentListV);
        nationCou.put("xinlijiangkang",studentList);
        nationCou.put("biyejiuye",studentLis);
        nationCou.put("danqinguer",studentLi);
        nationCou.put("xueyeyujing",studentL);
        nationCou.put("yanchibiye",student);
        nationCou.put("chufen",studen);
        return nationCou;
    }

    @Override
    public Map<String, Long> getStatisticsStudent(String departIds, String professionIds, String classIds) {
        List<NationPersonsVo> studentHanPersons = this.getHanPersonss(departIds,professionIds,classIds);
        List<NationPersonsVo> studentFewPersons = this.getFewPersons(departIds,professionIds,classIds);
        List<NationPersonsVo> studentBirthplacePersons = this.getBirthplacePersonss(departIds,professionIds,classIds);
        List<NationPersonsVo> studentBirthplacesPersons = this.getBirthplacesPersons(departIds,professionIds,classIds);
        List<NationPersonsVo> partysMembers = this.getPartysMembers(departIds,professionIds,classIds);
        List<NationPersonsVo> partyMembers = this.getPartyMemberss(departIds,professionIds,classIds);
        List<NationPersonsVo> difficultsSituation = this.getDifficultsSituation(departIds,professionIds,classIds);
        List<NationPersonsVo> difficultStuation = this.getDifficultStuation(departIds,professionIds,classIds);
        List<NationPersonsVo> psychologicalProblems = this.getPsychologicalProblems(departIds,professionIds,classIds);
        List<NationPersonsVo> psychologicalsProblem = this.getPsychologicalsProblem(departIds,professionIds,classIds);
        List<NationPersonsVo> tSingleParentOrphans = this.getSingleParentOrphans(departIds,professionIds,classIds);
        List<NationPersonsVo> tSinglesParentOrphan = this.getSinglesParentOrphan(departIds,professionIds,classIds);
        List<NationPersonsVo> tAcademicWarnings = this.getAcademicsWarnings(departIds,professionIds,classIds);
        List<NationPersonsVo> tAcademicsWarning = this.getAcademicsWarning(departIds,professionIds,classIds);

        Map<String,Long> nationCou=new HashMap<>();
        nationCou.put("hanzu",studentHanPersons.get(0).getCou());
        nationCou.put("shaoshumingzu",studentFewPersons.get(0).getCou());
        nationCou.put("lixiao",studentBirthplacePersons.get(0).getCou());
        nationCou.put("qitashengfeng",studentBirthplacesPersons.get(0).getCou());
        nationCou.put("zhonggongzongshu",partysMembers.get(0).getCou());
        nationCou.put("zhonggongdangyuan",partyMembers.get(0).getCou());
        nationCou.put("kunnanzongshu",difficultsSituation.get(0).getCou());
        nationCou.put("tebiekunnan",difficultStuation.get(0).getCou());
        nationCou.put("xinlizongshu",psychologicalProblems.get(0).getCou());
        nationCou.put("yumeng",psychologicalsProblem.get(0).getCou());
        nationCou.put("qanqinzongshu",tSingleParentOrphans.get(0).getCou());
        nationCou.put("guer",tSinglesParentOrphan.get(0).getCou());
        nationCou.put("xueyeyujingzongshu",tAcademicWarnings.get(0).getCou());
        nationCou.put("liuji",tAcademicsWarning.get(0).getCou());
        return nationCou;
    }

    @Override
    public Map<String, Long> getHanPersons(String departIds, String professionIds, String classIds) {
        List<NationPersonsVo> studentHanPersonss = this.getHanPersonss(departIds,professionIds,classIds);
        List<NationPersonsVo> studentFewPersons = this.getFewPersons(departIds,professionIds,classIds);

        Map<String,Long> nationCou=new HashMap<>();
        nationCou.put("汉族",studentHanPersonss.get(0).getCou());
        nationCou.put("少数民族",studentFewPersons.get(0).getCou());
        return nationCou;
    }

    @Override
    public Map<String, Long> getBirthplacePersons(String departIds, String professionIds, String classIds) {
        List<NationPersonsVo> studentBirthplacePersons = this.getBirthplacePersonss(departIds,professionIds,classIds);
        List<NationPersonsVo> studentBirthplacesPersons = this.getBirthplacesPersons(departIds,professionIds,classIds);
        Map<String,Long> nationCou=new HashMap<>();
        nationCou.put("宁夏",studentBirthplacePersons.get(0).getCou());
        nationCou.put("其他省份",studentBirthplacesPersons.get(0).getCou());
        return nationCou;
    }

    @Override
    public Map<String, Long> getPartyMembers(String departIds, String professionIds, String classIds) {
        List<NationPersonsVo> partysMembers = this.getPartysMembers(departIds,professionIds,classIds);
        List<NationPersonsVo> partyMembers = this.getPartyMemberss(departIds,professionIds,classIds);

        Map<String,Long> nationCou=new HashMap<>();
        nationCou.put("总数",partysMembers.get(0).getCou());
        nationCou.put("中共党员",partyMembers.get(0).getCou());
        return nationCou;
    }

    @Override
    public Map<String, Long> getDifficultSituation(String departIds, String professionIds, String classIds) {
        List<NationPersonsVo> difficultsSituation = this.getDifficultsSituation(departIds,professionIds,classIds);
        List<NationPersonsVo> difficultStuation = this.getDifficultStuation(departIds,professionIds,classIds);

        Map<String,Long> nationCou=new HashMap<>();
        nationCou.put("总数",difficultsSituation.get(0).getCou());
        nationCou.put("特别困难",difficultStuation.get(0).getCou());
        return nationCou;
    }

    @Override
    public Map<String, Long> getPsychologicalProblem(String departIds, String professionIds, String classIds) {
        List<NationPersonsVo> psychologicalProblems = this.getPsychologicalProblems(departIds,professionIds,classIds);
        List<NationPersonsVo> psychologicalsProblem = this.getPsychologicalsProblem(departIds,professionIds,classIds);

        Map<String,Long> nationCou=new HashMap<>();
        nationCou.put("总数",psychologicalProblems.get(0).getCou());
        nationCou.put("抑郁",psychologicalsProblem.get(0).getCou());
        return null;
    }

    @Override
    public Map<String, Long> getSingleParentOrphan(String departIds, String professionIds, String classIds) {
        List<NationPersonsVo> tSingleParentOrphans = this.getSingleParentOrphans(departIds,professionIds,classIds);
        List<NationPersonsVo> tSinglesParentOrphan = this.getSinglesParentOrphan(departIds,professionIds,classIds);

        Map<String,Long> nationCou=new HashMap<>();
        nationCou.put("总数",tSingleParentOrphans.get(0).getCou());
        nationCou.put("孤儿",tSinglesParentOrphan.get(0).getCou());
        return nationCou;
    }

    @Override
    public Map<String, Long> getAcademicsWarninges(String departIds, String professionIds, String classIds) {
        List<NationPersonsVo> tAcademicWarnings = this.getAcademicsWarnings(departIds,professionIds,classIds);
        List<NationPersonsVo> tAcademicsWarning = this.getAcademicsWarning(departIds,professionIds,classIds);

        Map<String,Long> nationCou=new HashMap<>();
        nationCou.put("总数",tAcademicWarnings.get(0).getCou());
        nationCou.put("留级",tAcademicsWarning.get(0).getCou());
        return nationCou;
    }

    @Override
    public Map<String, Object> getStudentInfo(String stuId,List<StatisticsVo> stStateJilu, List<StatisticsVo> stSanctions) {
        StStudent stStudent = this.getStudent(stuId);
        Map<String,Object> nationCou=new HashMap<>();
        nationCou.put("id",stStudent.getId());
        nationCou.put("stName",stStudent.getStName());
        nationCou.put("sex",stStudent.getSex());
        nationCou.put("studentId",stStudent.getStudentId());
        nationCou.put("st_photo",stStudent.getStPhoto());
        nationCou.put("phone",stStudent.getPhone());
        nationCou.put("college",stStudent.getCollege());
        nationCou.put("profession",stStudent.getProfession());
        nationCou.put("stClass",stStudent.getStClass());
        nationCou.put("dormRoom",stStudent.getDormRoom());
        nationCou.put("nationality",stStudent.getNationality());
        nationCou.put("familyAddress",stStudent.getFamilyAddress());
        nationCou.put("parent_one",stStudent.getParentOne());
        nationCou.put("parent_two",stStudent.getParentTwo());
        nationCou.put("phoneOne",stStudent.getPhoneOne());
        nationCou.put("phone_two",stStudent.getPhoneTwo());
        nationCou.put("status",stStudent.getStatus());
        nationCou.put("field_two",stStudent.getFieldTwo());
        nationCou.put("field_one",stStudent.getFieldOne());
        nationCou.put("deleted",stStudent.getDeleted());
        nationCou.put("province",stStudent.getProvince());
        nationCou.put("city",stStudent.getCity());
        nationCou.put("area",stStudent.getArea());
        nationCou.put("face",stStudent.getFace());
        nationCou.put("difficult",stStudent.getDifficult());
        nationCou.put("graduation",stStudent.getGraduation());
        nationCou.put("single",stStudent.getSingle());
        nationCou.put("punish",stStudent.getPunish());
        nationCou.put("psychological",stStudent.getPsychological());
        nationCou.put("academicWarning",stStudent.getAcademicWarning());
        nationCou.put("delayedGraduation",stStudent.getDelayedGraduation());
        nationCou.put("remark",stStudent.getRemark());
        nationCou.put("coul",stStudent.getCoul());
        if (stStateJilu!=null&&stStateJilu.size()>0) {
        nationCou.put("coux",stStateJilu.get(0).getCou());
        }
        if (stSanctions!=null&&stSanctions.size()>0) {
        nationCou.put("couc",stSanctions.get(0).getCou());
        }
        return nationCou;
    }

    @Override
    public List<NationPersonsVo> getDelayedGraduations(String departIds, String professionIds, String classIds,String fieldTwo){
        List<NationPersonsVo> DelayedGraduations= stStudentMapper.getDelayedGraduations(departIds,professionIds,classIds,fieldTwo);
        return DelayedGraduations;
    }

    @Override
    public List<NationPersonsVo> getDifficults(String departIds, String professionIds, String classIds,String fieldTwo){
        List<NationPersonsVo> difficults= stStudentMapper.getDifficults(departIds,professionIds,classIds,fieldTwo);
        return difficults;
    }

    @Override
    public List<NationPersonsVo> getFacePersons(String departIds, String professionIds, String classIds,String fieldTwo){
        List<NationPersonsVo> facePersons= stStudentMapper.getFacePersons(departIds,professionIds,classIds,fieldTwo);
        return facePersons;
    }

    @Override
    public List<NationPersonsVo> getNationPersons(String departIds, String professionIds, String classIds,String fieldTwo){
        List<NationPersonsVo> nationPersonsVos= stStudentMapper.getNationPersons(departIds,professionIds,classIds,fieldTwo);
        return nationPersonsVos;
    }

    @Override
    public List<NationPersonsVo> getHanPersonss(String departIds, String professionIds, String classIds) {
        List<NationPersonsVo> HanPersons= stStudentMapper.getHanPersonss(departIds,professionIds,classIds);
        return HanPersons;
    }

    @Override
    public List<NationPersonsVo> getFewPersons(String departIds, String professionIds, String classIds) {
        List<NationPersonsVo> FewPersons= stStudentMapper.getFewPersons(departIds,professionIds,classIds);
        return FewPersons;
    }

    @Override
    public List<NationPersonsVo> getBirthplacePersonss(String departIds, String professionIds, String classIds) {
        List<NationPersonsVo> BirthplacePersons= stStudentMapper.getBirthplacePersonss(departIds,professionIds,classIds);
        return BirthplacePersons;
    }

    @Override
    public List<NationPersonsVo> getBirthplacesPersons(String departIds, String professionIds, String classIds) {
        List<NationPersonsVo> BirthplacesPersons= stStudentMapper.getBirthplacesPersons(departIds,professionIds,classIds);
        return BirthplacesPersons;
    }

    @Override
    public List<NationPersonsVo> getPartysMembers(String departIds, String professionIds, String classIds) {
        List<NationPersonsVo> PartysMembers= stStudentMapper.getPartysMembers(departIds,professionIds,classIds);
        return PartysMembers;
    }

    @Override
    public List<NationPersonsVo> getPartyMemberss(String departIds, String professionIds, String classIds) {
        List<NationPersonsVo> PartyMembers= stStudentMapper.getPartyMemberss(departIds,professionIds,classIds);
        return PartyMembers;
    }

    @Override
    public List<NationPersonsVo> getDifficultsSituation(String departIds, String professionIds, String classIds) {
        List<NationPersonsVo> DifficultsSituation= stStudentMapper.getDifficultsSituation(departIds,professionIds,classIds);
        return DifficultsSituation;
    }

    @Override
    public List<NationPersonsVo> getDifficultStuation(String departIds, String professionIds, String classIds) {
        List<NationPersonsVo> DifficultStuation= stStudentMapper.getDifficultStuation(departIds,professionIds,classIds);
        return DifficultStuation;
    }

    @Override
    public List<NationPersonsVo> getPsychologicalProblems(String departIds, String professionIds, String classIds) {
        List<NationPersonsVo> PsychologicalProblems= stStudentMapper.getPsychologicalProblems(departIds,professionIds,classIds);
        return PsychologicalProblems;
    }

    @Override
    public List<NationPersonsVo> getPsychologicalsProblem(String departIds, String professionIds, String classIds) {
        List<NationPersonsVo> PsychologicalsProblem= stStudentMapper.getPsychologicalsProblem(departIds,professionIds,classIds);
        return PsychologicalsProblem;
    }

    @Override
    public List<NationPersonsVo> getSingleParentOrphans(String departIds, String professionIds, String classIds) {
        List<NationPersonsVo> SingleParentOrphans= stStudentMapper.getSingleParentOrphans(departIds,professionIds,classIds);
        return SingleParentOrphans;
    }

    @Override
    public List<NationPersonsVo> getSinglesParentOrphan(String departIds, String professionIds, String classIds) {
        List<NationPersonsVo> SinglesParentOrphan= stStudentMapper.getSinglesParentOrphan(departIds,professionIds,classIds);
        return SinglesParentOrphan;
    }

    @Override
    public List<NationPersonsVo> getAcademicsWarnings(String departIds, String professionIds, String classIds) {
        List<NationPersonsVo> AcademicsWarnings= stStudentMapper.getAcademicsWarnings(departIds,professionIds,classIds);
        return AcademicsWarnings;
    }

    @Override
    public List<NationPersonsVo> getAcademicsWarning(String departIds, String professionIds, String classIds) {
        List<NationPersonsVo> AcademicsWarning= stStudentMapper.getAcademicsWarning(departIds,professionIds,classIds);
        return AcademicsWarning;
    }

    @Override
    public List<NationPersonsVo> getNationPeople(String college, String fieldTwo, String profession, String stClass) {
        List<NationPersonsVo> nationPeopleVos= stStudentMapper.getNationPeople(college,fieldTwo,profession,stClass);
        return nationPeopleVos;
    }

    @Override
    public List<NationPersonsVo> getNationPeoples(String departIds, String professionIds, String classIds,String fieldTwo) {
        List<NationPersonsVo> nationPeopleVos= stStudentMapper.getNationPeoples(departIds,fieldTwo,professionIds,classIds);
        return nationPeopleVos;
    }

    @Override
    public List<ProvinceVo> getProvincePeoples(String college, String fieldTwo, String profession, String stClass) {
        List<ProvinceVo> provincePeoples= stStudentMapper.getProvincePeoples(college,fieldTwo,profession,stClass);
        return provincePeoples;
    }

    @Override
    public List<CityVo> getCityPeoples(String college, String fieldTwo, String profession, String stClass) {
        List<CityVo> cityPeoples= stStudentMapper.getCityPeoples(college,fieldTwo,profession,stClass);
        return cityPeoples;
    }

    @Override
    public List<AreaVo> getAreaPeoples(String college, String fieldTwo, String profession, String stClass) {
        List<AreaVo> areaPeoples= stStudentMapper.getAreaPeoples(college,fieldTwo,profession,stClass);
        return areaPeoples;
    }

    @Override
    public List<StStateJiluForAdmin> getStatus(String ids) {
        List<StStateJiluForAdmin> getStatuss= stStudentMapper.getStatus(ids.split(","));
        return getStatuss;
    }

    @Override
    public List<DepartVo> getDepart() {
        List<DepartVo> departs= stStudentMapper.getDepart();
        return departs;
    }


    @Override
    public List<DepartVo> getDepart(String orgCode) {
        List<DepartVo> departs= stStudentMapper.getDepartByOrgCode(orgCode);
        return departs;
    }

    @Override
    public List<ProvincesVo> getProvinces(String departs,String professions,String classs,String fieldTwo){
        List<ProvincesVo> Provincesna= stStudentMapper.getProvinces(departs,professions,classs,fieldTwo);
        return Provincesna;
    }

    @Override
    public List<NationPersonsVo> getProvincesSt(String departIds, String professionIds, String classIds,String fieldTwo) {
        List<NationPersonsVo> nationPeopleVos= stStudentMapper.getProvincesSt(departIds,fieldTwo,professionIds,classIds);
        return nationPeopleVos;
    }

    @Override
    public List<ProvincesVo> getCitys(String departs, String professions, String classs,String pid,String fieldTwo) {
        List<ProvincesVo> Provincestc= stStudentMapper.getCitys(departs,professions,classs,pid,fieldTwo);
        return Provincestc;
    }

    @Override
    public List<ProvincesVo> getAreas(String departs, String professions, String classs,String sid,String fieldTwo) {
        List<ProvincesVo> Provincesar= stStudentMapper.getAreas(departs,professions,classs,sid,fieldTwo);
        return Provincesar;
    }

    @Override
    public List<StatisticsVo> getStatistics(String keyword,String departs, String[] nationality, String[] fieldTwo,String[] face, String[] punish,String[] graduation,String[] single,String[] difficult,String[] psychological,String[] academicWarning,String[] delayedGraduation) {
        List<StatisticsVo> statisticsVo= stStudentMapper.getStatistics(keyword,departs,nationality,fieldTwo,face,punish,graduation,single,difficult,psychological,academicWarning,delayedGraduation);
        return statisticsVo;
    }

    @Override
    public List<StStudent> getSchoolLeaverList(String college) {
        List<StStudent> schoolLeaverList= stStudentMapper.getSchoolLeaverList(college);
        return schoolLeaverList;
    }

    @Override
    public List<StStudent> updateStatuses(String ids) {
        List<StStudent> updateStatuses= stStudentMapper.updateStatuses(ids.split(","));
        return updateStatuses;
    }

    @Override
    public List<String> getStatuses(String ids) {
        List<String> getStatuses= stStudentMapper.getStatuses(ids.split(","));
        return getStatuses;
    }


}
